package fr.epsi.studentsmaps;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;

import fr.epsi.ressources.Epsirooms;
import fr.epsi.ressources.Room;
import fr.epsi.ressources.RoomCustomList;
import fr.epsi.services.LocalisationService;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

public class RoomActivity extends Activity implements OnClickListener {

	private ListView roomlist;
	
	    @Override
	    protected void onCreate(Bundle savedInstanceState) {
	        super.onCreate(savedInstanceState);
	        
	        setContentView(R.layout.roomlist);
	        
	        Epsirooms epsi = new Epsirooms();
	        
	        RoomCustomList adapter = new
	                RoomCustomList(this,epsi.getNameArray(), epsi.getPictureArray());
	        roomlist=(ListView)findViewById(R.id.roomList);
	        roomlist.setAdapter(adapter);
	        roomlist.setOnItemClickListener(new AdapterView.OnItemClickListener() {
	                    @Override
	                    public void onItemClick(AdapterView<?> parent, View view,
	                                            int position, long id) 
	                    {
	                    	Intent intent = new Intent(RoomActivity.this, RoomDetailsActivity.class);
	                    	intent.putExtra("extraRoom", position);
	                    	startActivity(intent);
	                    }
	                });
	    }

	    
	    
		@Override
		public void onClick(DialogInterface arg0, int arg1) {
			// TODO Auto-generated method stub
			
		}
}
